<?php
declare(strict_types=1);
/**
 * MineAdmin is committed to providing solutions for quickly building web applications
 * Please view the LICENSE file that was distributed with this source code,
 * For the full copyright and license information.
 * Thank you very much for using MineAdmin.
 *
 * @Author X.Mo<root@imoi.cn>
 * @Link   https://gitee.com/xmo/MineAdmin
 */

namespace Plugin\Attractions\Commerce\Controller\Commerce_commodity_type;

use Plugin\Attractions\Commerce\Service\Commerce_commodity_type\CommerceCommodityTypeService;
use Plugin\Attractions\Commerce\Request\Commerce_commodity_type\CommerceCommodityTypeRequest;
use Plugin\Attractions\Commerce\Schema\Commerce_commodity_type\CommerceCommodityTypeSchema;
use App\Http\Admin\Middleware\PermissionMiddleware;
use App\Http\Common\Middleware\AccessTokenMiddleware;
use App\Http\Common\Middleware\OperationMiddleware;
use App\Http\Common\Result;
use App\Http\CurrentUser;
use Hyperf\HttpServer\Request;
use Hyperf\HttpServer\Annotation\Middleware;
use Hyperf\Swagger\Annotation\Delete;
use Hyperf\Swagger\Annotation\Get;
use Hyperf\Swagger\Annotation\HyperfServer;
use Hyperf\Swagger\Annotation\JsonContent;
use Hyperf\Swagger\Annotation\Post;
use Hyperf\Swagger\Annotation\Put;
use Hyperf\Swagger\Annotation\RequestBody;
use Mine\Access\Attribute\Permission;
use Mine\Swagger\Attributes\PageResponse;
use App\Http\Admin\Controller\AbstractController as AdminAbstractController;

/**
 * 商品类型控制器
 * Class CommerceCommodityTypeController
 */
#[HyperfServer(name: 'http')]
final class CommerceCommodityTypeApiController extends AdminAbstractController
{

     /**
     * 业务处理服务
     * CommerceCommodityTypeService
     */
    public function __construct(
        protected readonly CommerceCommodityTypeService $service
    ) {}

    

    #[Get(
        path: '/commerce_commodity_type/commerceCommodityType/api/list',
        operationId: 'Commerce_commodity_typeCommercecommoditytypeApiList',
        summary: '商品类型控制器列表',
        tags: ['商品类型控制器'],
    )]
    #[PageResponse(instance: CommerceCommodityTypeSchema::class)]
    public function page(Request $request): Result
    {
        return $this->success(data: $this->service->page($request->all(), (int) $request->query('page'), (int) $request->query('page_size')));
    }
}